//
//  AddNumInfoApi.m
//  RONGAO
//
//  Created by Kendama on 2018/3/1.
//  Copyright © 2018年 wei wang. All rights reserved.
//

#import "AddNumInfoApi.h"

@implementation AddNumInfoApi
{
    NSDictionary *_dic;
}

-(id)initWithDic:(NSDictionary *)dic{
    if (self = [super init]) {
        _dic = dic;
    }
    return self;
}

- (NSString *)requestUrl {
    return @"/device/device_control";
}

- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPOST;
}

- (id)requestArgument {
    NSMutableDictionary *dic = [NSMutableDictionary getPubdic];
    
    [dic setValuesForKeysWithDictionary:_dic];
    NSString *sign=[NSString getSign:dic];
    [dic setObject:sign forKey:@"sign"];
    return dic;
}


-(void)dealloc
{
    NSLog(@"%@ dealloc",[self class]);
}

+(void)addNumInfoDeviceMac:(NSString *)deviceMac Type:(int)type num:(NSString *)num name:(NSString *)name success:(void (^)(NSDictionary *))successBack fail:(void (^)(NSDictionary *))failBack
{
    NSMutableDictionary *requestDic = [[NSMutableDictionary alloc]init];
    [requestDic setValue:deviceMac forKey:@"device_mac"];
    [requestDic setValue:@(type).stringValue forKey:@"type"];
    [requestDic setValue:num forKey:@"num"];
    [requestDic setValue:name forKey:@"name"];

    
    AddNumInfoApi *api = [[AddNumInfoApi alloc]initWithDic:requestDic];
    [api dtStartYTKRequestCompletionBlockWithSuccess:^(YTKBaseRequest * _Nonnull request) {
        if (successBack) {
            successBack(request.responseObject);
        }
    } failure:^(YTKBaseRequest * _Nonnull request) {
        if (failBack) {
            failBack(request.responseObject);
        }
    }];
}
@end
